<%--
  Created by IntelliJ IDEA.
  User: 李赏赏
  Date: 2024/6/11
  Time: 14:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%--
1、jsp的四个作用域
2、分别是
    pageContext    PageContext            页面域对象       作用范围是当前页面
    request        HttpServletRequest     请求域对象       作用范围是一次请求
    session        HttpSession            会话域对象       作用范围是一次会话
    application    ServletContext         服务器域对象      作用范围是整个web应用
3、语法
四个域对象添加、获取、移除值调用的方法都是一样的
	获取值 getAttribute(String key)
	设置值 setAttribute(String key,Object value)
	移除值 removeAttribute(String key)
--%>
<%
   pageContext.setAttribute("name","张三");
   request.setAttribute("age",18);
   session.setAttribute("sex","男");
   application.setAttribute("hobby","吃饭");

   //转发demo06.jsp
    //request.getRequestDispatcher("demo06.jsp").forward(request,response);
    //response.sendRedirect("demo06.jsp");

%>

pageContext: <%= pageContext.getAttribute("name")%> <br>
request: <%= request.getAttribute("age")%><br>
session: <%= session.getAttribute("sex")%><br>
application: <%= application.getAttribute("hobby")%><br>


</body>
</html>
